import request from '@/utils/request'

// 查询分类列表
export function listCategory(query) {
  return request({
    url: '/goods_manage/category/list',
    method: 'get',
    params: query
  })
}

// 查询所有分类
export function findAllCategory(query) {
  return request({
    url: '/goods_manage/category/findAllCategory',
    method: 'get',
    params: query
  })
}

// 统计商品的分类
export function statisticsCategory(query) {
  return request({
    url: '/goods_manage/category/statisticsCategory',
    method: 'get',
    params: query
  })
}
//  统计商品的分类柱状图使用
export function statisticsCategoryHistogram(query) {
  return request({
    url: '/goods_manage/category/statisticsCategoryHistogram',
    method: 'get',
    params: query
  })
}



// 查询分类详细
export function getCategory(id) {
  return request({
    url: '/goods_manage/category/' + id,
    method: 'get'
  })
}

// 新增分类
export function addCategory(data) {
  return request({
    url: '/goods_manage/category',
    method: 'post',
    data: data
  })
}

// 修改分类
export function updateCategory(data) {
  return request({
    url: '/goods_manage/category',
    method: 'put',
    data: data
  })
}

// 删除分类
export function delCategory(id) {
  return request({
    url: '/goods_manage/category/' + id,
    method: 'delete'
  })
}
